package system.common;

import collector.core.util.DateUtil;
import collector.core.util.StringUtil;

/**
 * <pre>
 * Class : system.common.Arguments / Arguments.java
 * 	Define Class Object : 
 * <br>
 * </pre>
 * @author hwanLee / apexcns,Inc.
 * @version 1.0
 * @see javadoc
 * @since 2012. 9. 12.
 */
public class Arguments {
	private String Parameter0;		// Command
	private String Parameter1;		// (Conditional) Duration Type
	private String Parameter2;		// (Conditional) Start from Time
	private String Parameter3;		// (Conditional) End to Time
	private String DBName;			// DB Name - Date
	private String DBFullName;		// DB Full Name
	private String TableName1;		// Table Full Name 1
	private String TableName2;		// Table Full Name 2
	private String FileName1;			// File Name 1
	private String FileName2;			// File Name 2
	
	/** <pre>
     * Method : Arguments.getParameter0()
     * 	to get Parameter0
     * <br> 
     * @return the Parameter0 : type of String
     * </pre>
     */
	public String getParameter0() {
		return Parameter0;
	}
	/** <pre>
     * Method : Arguments.setParameter0()
     * 	to set Parameter0
     * <br> 
     * @return type of void
     * <br>
     * @param Parameter0 
     * </pre>
     */
	public void setParameter0(String Parameter0) {
		this.Parameter0 = Parameter0;
	}
	/** <pre>
     * Method : Arguments.getParameter1()
     * 	to get Parameter1
     * <br> 
     * @return the Parameter1 : type of String
     * </pre>
     */
	public String getParameter1() {
		return Parameter1;
	}
	/** <pre>
     * Method : Arguments.setParameter1()
     * 	to set Parameter1
     * <br> 
     * @return type of void
     * <br>
     * @param Parameter1 
     * </pre>
     */
	public void setParameter1(String Parameter1) {
		this.Parameter1 = Parameter1;
	}
	/** <pre>
     * Method : Arguments.getParameter2()
     * 	to get Parameter2
     * <br> 
     * @return the Parameter2 : type of String
     * </pre>
     */
	public String getParameter2() {
		return Parameter2;
	}
	/** <pre>
     * Method : Arguments.setParameter2()
     * 	to set Parameter2
     * <br> 
     * @return type of void
     * <br>
     * @param Parameter2 
     * </pre>
     */
	public void setParameter2(String Parameter2) {
		this.setFileName1(DateUtil.getFmtDateTime(Parameter2, "", 22));
		this.setDBName(DateUtil.getFmtDateTime(Parameter2, "", 8));
		this.Parameter2 = this.convertParameter(Parameter2);
	}
	/** <pre>
     * Method : Arguments.setParameter2()
     * 	to set Parameter2
     * <br> 
     * @return type of void
     * <br>
     * @param Parameter2 
     * @param cmd
     * </pre>
     */
	public void setParameter2(String Parameter2, int cmd) {
		switch (cmd) {
		case 1: // yyyy-MM-dd HH:mm
			this.Parameter2 = DateUtil.getFmtDateTime(Parameter2, 12);
			break;
		default: // default
			this.Parameter2 = Parameter2;
			break;
		}
	}
	/** <pre>
     * Method : Arguments.getParameter3()
     * 	to get Parameter3
     * <br> 
     * @return the Parameter3 : type of String
     * </pre>
     */
	public String getParameter3() {
		return Parameter3;
	}
	/** <pre>
     * Method : Arguments.setParameter3()
     * 	to set Parameter3
     * <br> 
     * @return type of void
     * <br>
     * @param Parameter3 
     * </pre>
     */
	public void setParameter3(String Parameter3) {
		String str = "";
		if (this.Parameter1.equals("DAY")) {
			str = Parameter3.substring(0, 8) + "2359";
		} else if (this.Parameter1.equals("HOUR")) {
			str = Parameter3.substring(0, 10) + "59";
		} else if (this.Parameter1.equals("MIN")) {
			str = Parameter3.substring(0, 12);
		} else if (this.Parameter1.equals("SEC")) {
			str = Parameter3.substring(0, 14);
		}
		this.setFileName2(DateUtil.getFmtDateTime(Parameter3, "", 22));
		this.Parameter3 = this.convertParameter(str);
	}
	/** <pre>
     * Method : Arguments.setParameter3()
     * 	to set Parameter3
     * <br> 
     * @return type of void
     * <br>
     * @param Parameter3 
     * @param cmd
     * </pre>
     */
	public void setParameter3(String Parameter3, int cmd) {
		switch (cmd) {
		case 1: // yyyy-MM-dd HH:mm
			this.Parameter3 = DateUtil.getFmtDateTime(Parameter3, 12);
			break;
		default: // default
			this.Parameter3 = Parameter3;
			break;
		}
	}
	/** <pre>
     * Method : Arguments.getDBName()
     * 	to get DBName
     * <br> 
     * @return the DBName : type of String
     * </pre>
     */
	public String getDBName() {
		return DBName;
	}
	/** <pre>
     * Method : Arguments.setDBName()
     * 	to set DBName
     * <br> 
     * @return type of void
     * <br>
     * @param DBName 
     * </pre>
     */
	public void setDBName(String DBName) {
		if (this.Parameter0.equals("WEBKEEPER_01")) {
			this.DBName = StringUtil.replaceAll(DateUtil.getFmtDateTime(DBName), "-", "_");
		} else {
			this.DBName = DBName;
		}
	}
	/** <pre>
     * Method : Arguments.getDBFullName()
     * 	to get DBFullName
     * <br> 
     * @return the DBFullName : type of String
     * </pre>
     */
	public String getDBFullName() {
		return DBFullName;
	}
	/** <pre>
     * Method : Arguments.setDBFullName()
     * 	to set DBFullName
     * <br> 
     * @return type of void
     * <br>
     * @param DBFullName 
     * </pre>
     */
	public void setDBFullName(String DBFullName) {
		this.DBFullName = DBFullName;
	}
	/** <pre>
     * Method : Arguments.getParameter0()
     * 	to get Parameter0
     * <br> 
     * @return the Parameter0 : type of String
     * </pre>
     */
	public String getTableName1() {
		return TableName1;
	}
	/** <pre>
     * Method : Arguments.setTableName1()
     * 	to set TableName1
     * <br> 
     * @return type of void
     * <br>
     * @param TableName1 
     * </pre>
     */
	public void setTableName1(String TableName1) {
		this.TableName1 = TableName1;
	}
	/** <pre>
     * Method : Arguments.getParameter0()
     * 	to get Parameter0
     * <br> 
     * @return the Parameter0 : type of String
     * </pre>
     */
	public String getTableName2() {
		return TableName2;
	}
	/** <pre>
     * Method : Arguments.setTableName2()
     * 	to set TableName2
     * <br> 
     * @return type of void
     * <br>
     * @param TableName2 
     * </pre>
     */
	public void setTableName2(String TableName2) {
		this.TableName2 = TableName2;
	}
	/** <pre>
     * Method : Arguments.getParameter0()
     * 	to get Parameter0
     * <br> 
     * @return the Parameter0 : type of String
     * </pre>
     */
	public String getFileName1() {
		return FileName1;
	}
	/** <pre>
     * Method : Arguments.setFileName1()
     * 	to set FileName1
     * <br> 
     * @return type of void
     * <br>
     * @param FileName1 
     * </pre>
     */
	public void setFileName1(String FileName1) {
		this.FileName1 = FileName1;
	}
	/** <pre>
     * Method : Arguments.getParameter0()
     * 	to get Parameter0
     * <br> 
     * @return the Parameter0 : type of String
     * </pre>
     */
	public String getFileName2() {
		return FileName2;
	}
	/** <pre>
     * Method : Arguments.setFileName2()
     * 	to set FileName2
     * <br> 
     * @return type of void
     * <br>
     * @param FileName2 
     * </pre>
     */
	public void setFileName2(String FileName2) {
		this.FileName2 = FileName2;
	}
	
	private String convertParameter(String str) {
		if (this.Parameter0.equals("WEBKEEPER_01") || this.Parameter0.equals("WEBKEEPER_02")
				|| this.Parameter0.equals("WEBKEEPER_MIGRATE_01") || this.Parameter0.equals("WEBKEEPER_MIGRATE_02")
				|| this.Parameter0.equals("MSG_I_01") || this.Parameter0.equals("MSG_I_02")
				|| this.Parameter0.equals("MSG_I_03") || this.Parameter0.equals("DB_I_01")
				|| this.Parameter0.equals("PRIVACY_I_01") || this.Parameter0.equals("REDCASTLE_01")
				|| this.Parameter0.equals("REDCASTLE_02") || this.Parameter0.equals("REDCASTLE_03")
				|| this.Parameter0.equals("IDESK_01")) {
			str = DateUtil.getFmtDateTime(str, 14);
		} else {
			str = DateUtil.getFmtDateTime(str, "", 24);
		}
		return str;
	}
}